package com.iogogogo.activity.configuration;


import com.fasterxml.jackson.databind.ObjectMapper;
import com.iogogogo.activity.base.IJacksonConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

/**
 * Created by tao.zeng on 2022/6/16.
 */
public class JacksonConfiguration {

    /**
     * Object mapper object mapper.
     *
     * @return the object mapper
     */
    @Bean
    public ObjectMapper objectMapper() {
        return IJacksonConfiguration.OBJECT_MAPPER;
    }

    /**
     * Jackson 2 http message converter mapping jackson 2 http message converter.
     *
     * @return the mapping jackson 2 http message converter
     */
    @Bean
    public MappingJackson2HttpMessageConverter jackson2HttpMessageConverter() {
        return new MappingJackson2HttpMessageConverter(objectMapper());
    }
}
